package cn.xuchunh.campusbbs.ui.activities;

import android.text.TextUtils;

import cn.xuchunh.campusbbs.R;
import cn.xuchunh.campusbbs.ui.fragments.SearchFragment;
import cn.xuchunh.campusbbs.utils.IntentParamsKey;

/**
 * Created by XuChunH on 2015/9/22.
 */
public class SearchActivity extends FragmentContainerActivity<SearchFragment> {

    private String query;

    @Override
    protected SearchFragment getFrament() {
        return SearchFragment.getInstance(query);
    }

    @Override
    protected int containerId() {
        return R.id.container;
    }

    @Override
    protected int createContentRes() {
        return R.layout.layout_simple_container;
    }

    @Override
    protected void beforeInitView() {
        setShowHomeUp(true);
        query = getIntent().getStringExtra(IntentParamsKey.SEARCH_QUERY);
        if (TextUtils.isEmpty(query)) {
            finish();
        }
    }
}
